﻿using System.Collections.Generic;

namespace JSC.Portal.Utils
{
    public static class ExtensionMethods
    {
        public static bool IsNullOrEmpty<T>(this ICollection<T> collection)
        {
            return (collection == null || (collection != null && collection.Count == 0));
        }

        public static IDictionary<TKey, TValue> Convert<TKey, TValue>(this System.Collections.IDictionary dictionary)
        {
            Dictionary<TKey, TValue> result = new Dictionary<TKey, TValue>();
            foreach (TKey key in dictionary.Keys)
            {
                TValue value = (TValue)dictionary[key];
                result.Add(key, value);
            }
            return result;
        }

        //public static TEnum Parse<TEnum>(this Enum enumobject, string stringEnumValue)
        //{
        //    return (TEnum) Enum.Parse(typeof(TEnum), stringEnumValue);
        //}
    
    }
}
